<?php

namespace Boosen\Admin\Contents\Models;

use Encore\Admin\Traits\AdminBuilder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Post extends Model
{
    use SoftDeletes, AdminBuilder;

    protected $table = 'boosen_posts';

    protected $casts = [
        'extra' => 'json',
    ];

    public function scopeReleased($query)
    {
        return $query->where('released', 1);
    }

    public function scopeUnreleased($query)
    {
        return $query->where('released', 0);
    }
    public function scopeRecent($query)
    {
        return $query->orderBy('created_at', 'desc');
    }
}
